[turbopack] Shrink ReadRawVcFuture from 80 to 64 bytes#94135
Draft
lukesandberg wants to merge 2 commits into
Draft
[turbopack] Shrink ReadRawVcFuture from 80 to 64 bytes#94135lukesandberg wants to merge 2 commits into
lukesandberg wants to merge 2 commits into
Conversation
`ReadRawVcFuture` operates in two phases — resolving the `RawVc` pointer chain, then reading the resolved cell — and previously held the fields for both phases simultaneously. Phase 1 carried unused `Option<(TaskId, CellId)>` and `Option<EventListener>` for phase 2, and phase 2 carried the now-finished `ResolveRawVcFuture`. Move the phase-specific fields into a `ReadRawVcState` enum so only one set is live at a time. `read_cell_options` and `strongly_consistent` stay in the outer struct since both phases (and the builder) need them.
Two small changes to the TaskInput impls that compound across hundreds of
awaitee positions:
- Vc<T>::resolve_input now returns Vc::resolve() directly instead of an
async fn body around to_resolved().await. The async fn envelope was
pure overhead since the body had no other awaits — resolve() already
returns a Future<Output = Result<Vc<T>>>, which is exactly the trait's
signature. Using resolve() rather than to_resolved() + deref avoids
the otherwise-discouraged-but-here-correct ResolvedVc round-trip.
- ResolvedVc<T>::resolve_input override removed. It was `async fn ... { Ok(*self) }`
which is identical in size and behavior to the default
`async { Ok(self.clone()) }` for Copy types.
Measured with -Zprint-type-sizes on next-napi-bindings:
- Per-Vc<X>::resolve_input future shrinks from 48 B to 32 B (-33%)
- Cascades into ~36 distinct concrete Vc<X> types and dozens of tuple
TaskInput impls that contain Vc<T> fields
- Total awaitee-byte reduction across turbo/next contexts: ~94 KB
Contributor
Tests PassedCommit: 8eb0ac4 |
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
Stats skippedCommit: 8eb0ac4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.